package lanqiao;

import java.util.Arrays;
import java.util.Scanner;

public class test2_2 {
    //203
    public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);
        String str1 = scan.next();
        String str2 = scan.next();
        if(str1.length()!=str2.length()){
            System.out.println("NO");
            System.exit(0);
        }

        char[] chars1 = str1.toCharArray();
        char[] chars2 = str2.toCharArray();
        Arrays.sort(chars1);
        Arrays.sort(chars2);
        String str3=new String(chars1);
        String str4=new String(chars2);
        if(str3.endsWith(str4)){
            System.out.println("YES");
        }
        else {
            System.out.println("NO");

        }

    }
}
